import { Role } from '@/common/struct';
import { Button } from '@/common/shared';

const columns = [
  Role.name,
  Role.key,
  Role.enable,
  { ...Role.remark, group: 'extra' },
  Role.createTime,
  Role.updateTime,
];

export const actionButtons = [
  {
    key: 'bindMenu',
    props: { children: '菜单' },
  },
  Button.Update,
  Button.Remove,
];

export const buttons = [
  {
    key: 'tableRender',
    tip: '表格',
    group: 'switchRender',
    props: ({ renderType }) => ({
      type: renderType === 'table' ? 'primary' : 'dashed',
      children: '表格',
    }),
  },
  {
    key: 'cardRender',
    tip: '卡片',
    group: 'switchRender',
    props: ({ renderType }) => ({
      type: renderType === 'card' ? 'primary' : 'dashed',
      children: '卡片',
    }),
  },
  {
    key: 'batchRemove',
    type: 'waitButton',
    props: ({ selection }) => ({ danger: true, children: '批量删除', disabled: selection?.noneSelected }),
    sort: 210,
  },
];

export default columns;
